<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Pesquisa Filmes</title>
<style>

.ui-selectonemenu-item{
    width:70px;
	font-size:10px;
	font-style:italic;
	height:11px;
}

.ui-selectonemenu-list-item{
    width:70px;
	font-size:10px;
	font-style:italic;
	height:11px;
}

.ui-autocomplete input {
	width:200px;
	font-size:10px;
	font-style:italic;
	height:11px;
	text-transform:uppercase;
}

.ui-autocomplete-item{

	font-size:10px;
	font-style:italic;
}

.ui-autocomplete-list-item{

	font-size:10px;
	font-style:italic;
}

.ui-panel .ui-panel-footer .ui-panelgrid{
border-width: 1px 0 0;
margin: 0.5em 0 0;
padding: 0.5em 1em;
text-align: center;
font-size:10px;
font-style:italic;
font-weight:bold;
}

</style>
</h:head>
<h:body>
		<br/>
		<center>
		<p:panel style="font-size:10px; font-style: italic;margin-top: 0px;width: 795px;">
			<p:outputLabel value="Welcome #{LoginMB.login}."><p:commandButton value="SAIR" action="#{MenuMB.menu}" style="margin-left: 86%;"/></p:outputLabel>					
		</p:panel>
		
	<h:form id="form" style="font-size:10px;font-style: italic; width: 800px;">
		<p:panel id="panel" header="Pesquisa Filmes" footer="Sistema JFS PrimeFaces">
			<br/><p:outputLabel value="TÍTULO " style="margin-top:5px;text-transform:uppercase;font-size:10px;font-weight:bold;"/>
		
		<p:autoComplete id="nome" value="#{PesquisaMB.nome}" completeMethod="#{PesquisaMB.busca}"  minQueryLength="2" queryDelay="500" var="mov" itemLabel="#{mov.nome}" itemValue="#{mov.nome}" style="width:200px;font-size:10px;text-transform:uppercase;" size="20" forceSelection="true"/>
	
				<p:commandButton icon="ui-icon-search" action="#{PesquisaMB.buscaName(PesquisaMB.nome)}" style="margin-left: 10px;" update="table"/>
				
				<p:dataTable id="table" var="movie" value="#{PesquisaMB.filme}" style="font-size:10px; width: 765px; font-style: italic;margin-top:30px;text-transform:uppercase;">

		        	<p:column headerText="NOME" style="width: 265px;">  
		            	<h:outputText value="#{movie.nome}" />	  
		        	</p:column>
		        	
					<p:column headerText="NOME ORIGINAL" style="width: 265px;">  
		            	<h:outputText value="#{movie.nomeOriginal}" />	  
		        	</p:column>
		        	
		        	<p:column headerText="GENERO" style="width: 80px;">  
		            	<h:outputText value="#{movie.genero}" />
		            </p:column>
		        	
		        	<p:column headerText="DURAÇÃO" style="width: 70px;">  
		            	<h:outputText value="#{movie.duracao} minutos" />	  
		        	</p:column>
		        	
		        	<p:column headerText="STATUS" style="width: 70px;">  
		            	<h:outputText value="#{movie.status}" /> 
		        	</p:column>
		        	
		        	<p:column headerText="ANO" style="width: 30px;">  
		            	<h:outputText value="#{movie.ano}" />
		            </p:column>
		            
		            <p:column>  
		            	<p:commandLink styleClass="ui-icon ui-icon-pencil" actionListener="#{PesquisaMB.buscaId(movie)}" update=":form:dialog" oncomplete="PF('popup').show()"/>
		            </p:column>
		            
		            <p:column>  
		            	<p:commandLink styleClass="ui-icon ui-icon-trash" actionListener="#{PesquisaMB.buscaId(movie)}" update=":form:dialog3" oncomplete="PF('popupconfirmacarexclusao').show()"/>
		            </p:column>    
				
				</p:dataTable>
				
				<p:dialog id="dialog" widgetVar="popup" header="#{PesquisaMB.movie.nome}" showEffect="fade" hideEffect="fade">
					
					<p:panelGrid id="panel2" style="width:275px;font-size:10px;font-style:italic;" columns="2">
						
						<h:outputLabel value="NOME:"/>
						<p:inputText style="width:140px;font-size:10px;" value="#{PesquisaMB.movie.nome}" title="NOME"/>
						
						<h:outputLabel value="NOME ORIGINAL:"/>
						<p:inputText id="nomeoriginal" style="width:140px;font-size:10px;text-transform: uppercase;" value="#{PesquisaMB.movie.nomeOriginal}" title="NOME ORIGINAL"/>
						
						<h:outputLabel value="GÊNERO:"/>
							<p:selectOneMenu id="genero" style="width:150px;font-size:10px;" value="#{PesquisaMB.movie.genero}">
								<f:selectItem itemLabel=" - SELECIONE - " itemValue="null"/>
								<f:selectItem itemLabel="AÇÃO" itemValue="AÇÃO"/>
								<f:selectItem itemLabel="COMÉDIA" itemValue="COMÉDIA"/>
								<f:selectItem itemLabel="COMÉDIA ROMÂNTICA" itemValue="COMÉDIA ROMÂNTICA"/>
								<f:selectItem itemLabel="DRAMA" itemValue="DRAMA"/>
								<f:selectItem itemLabel="DOCUMENTÁRIO" itemValue="DOCUMENTÁRIO"/>
								<f:selectItem itemLabel="FICÇÃO CIENTÍFICA" itemValue="FICÇÃO CIENTÍFICA"/>
								<f:selectItem itemLabel="LUTA" itemValue="LUTA"/>
								<f:selectItem itemLabel="DESENHO" itemValue="DESENHO"/>
								<f:selectItem itemLabel="ANIMAÇÃO" itemValue="ANIMAÇÃO"/>
								<f:selectItem itemLabel="TERROR" itemValue="TERROR"/>
								<f:selectItem itemLabel="SUSPENSE" itemValue="SUSPENSE"/>
							</p:selectOneMenu>
						
						<h:outputLabel value="DURAÇÃO:"/>
						        <p:slider for="duracao" style="width:150px;margin-top: 5px;" maxValue="300">
						        <p:inputText id="duracao" style="width:140px;margin-top: 5px;" value="#{PesquisaMB.movie.duracao}"/> 
								</p:slider>
						
						<h:outputLabel value="STATUS:"/>
							<p:selectOneMenu id="status" style="width:150px;font-size:10px;" value="#{PesquisaMB.movie.status}">
								<f:selectItem itemLabel=" - SELECIONE - " itemValue="null"/>  
								<f:selectItem itemLabel="ASSISTIDO" itemValue="ASSISTIDO"/>
								<f:selectItem itemLabel="NÃO-ASSISTIDO" itemValue="NÃO-ASSISTIDO"/>
							</p:selectOneMenu>
						
						<h:outputLabel value="ANO:"/>
							<p:selectOneMenu id="ano" style="width:150px;font-size:10px;" value="#{PesquisaMB.movie.ano}">
								<f:selectItem itemLabel=" - SELECIONE - " itemValue="" />
								<f:selectItem itemLabel="2017" itemValue="2017"/>
								<f:selectItem itemLabel="2016" itemValue="2016"/>
								<f:selectItem itemLabel="2015" itemValue="2015"/>
								<f:selectItem itemLabel="2014" itemValue="2014"/>
								<f:selectItem itemLabel="2013" itemValue="2013"/>
								<f:selectItem itemLabel="2012" itemValue="2012"/>
								<f:selectItem itemLabel="2011" itemValue="2011"/>
								<f:selectItem itemLabel="2010" itemValue="2010"/>
								<f:selectItem itemLabel="2009" itemValue="2009"/>
								<f:selectItem itemLabel="2008" itemValue="2008"/>
								<f:selectItem itemLabel="2007" itemValue="2007"/>
								<f:selectItem itemLabel="2006" itemValue="2006"/>
								<f:selectItem itemLabel="2005" itemValue="2005"/>
								<f:selectItem itemLabel="2004" itemValue="2004"/>
								<f:selectItem itemLabel="2003" itemValue="2003"/>
								<f:selectItem itemLabel="2002" itemValue="2002"/>
								<f:selectItem itemLabel="2001" itemValue="2001"/>
								<f:selectItem itemLabel="2000" itemValue="2000"/>
								<f:selectItem itemLabel="1999" itemValue="1999"/>
								<f:selectItem itemLabel="1998" itemValue="1998"/>
								<f:selectItem itemLabel="1997" itemValue="1997"/>
								<f:selectItem itemLabel="1996" itemValue="1996"/>
								<f:selectItem itemLabel="1995" itemValue="1995"/>
								<f:selectItem itemLabel="1994" itemValue="1994"/>
								<f:selectItem itemLabel="1993" itemValue="1993"/>
								<f:selectItem itemLabel="1992" itemValue="1992"/>
								<f:selectItem itemLabel="1991" itemValue="1991"/>
								<f:selectItem itemLabel="1990" itemValue="1990"/>
								<f:selectItem itemLabel="1989" itemValue="1989"/>
								<f:selectItem itemLabel="1988" itemValue="1988"/>
								<f:selectItem itemLabel="1987" itemValue="1987"/>
								<f:selectItem itemLabel="1986" itemValue="1986"/>
								<f:selectItem itemLabel="1985" itemValue="1985"/>
								<f:selectItem itemLabel="1984" itemValue="1984"/>
								<f:selectItem itemLabel="1983" itemValue="1983"/>
								<f:selectItem itemLabel="1982" itemValue="1982"/>
								<f:selectItem itemLabel="1981" itemValue="1981"/>
								<f:selectItem itemLabel="1980" itemValue="1980"/>
								<f:selectItem itemLabel="1979" itemValue="1979"/>
								<f:selectItem itemLabel="1978" itemValue="1978"/>
								<f:selectItem itemLabel="1977" itemValue="1977"/>
								<f:selectItem itemLabel="1976" itemValue="1976"/>
								<f:selectItem itemLabel="1975" itemValue="1975"/>
								<f:selectItem itemLabel="1974" itemValue="1974"/>
								<f:selectItem itemLabel="1973" itemValue="1973"/>
								<f:selectItem itemLabel="1972" itemValue="1972"/>
								<f:selectItem itemLabel="1971" itemValue="1971"/>
								<f:selectItem itemLabel="1970" itemValue="1970"/>
								<f:selectItem itemLabel="1969" itemValue="1969"/>
								<f:selectItem itemLabel="1968" itemValue="1968"/>
								<f:selectItem itemLabel="1967" itemValue="1967"/>
								<f:selectItem itemLabel="1966" itemValue="1966"/>
								<f:selectItem itemLabel="1965" itemValue="1965"/>
								<f:selectItem itemLabel="1964" itemValue="1964"/>
								<f:selectItem itemLabel="1963" itemValue="1963"/>
								<f:selectItem itemLabel="1962" itemValue="1962"/>
								<f:selectItem itemLabel="1961" itemValue="1961"/>
								<f:selectItem itemLabel="1960" itemValue="1960"/>
								<f:selectItem itemLabel="1959" itemValue="1959"/>
								<f:selectItem itemLabel="1958" itemValue="1958"/>
								<f:selectItem itemLabel="1957" itemValue="1957"/>
								<f:selectItem itemLabel="1956" itemValue="1956"/>
								<f:selectItem itemLabel="1955" itemValue="1955"/>
								<f:selectItem itemLabel="1954" itemValue="1954"/>
								<f:selectItem itemLabel="1953" itemValue="1953"/>
								<f:selectItem itemLabel="1952" itemValue="1952"/>
								<f:selectItem itemLabel="1951" itemValue="1951"/>
								<f:selectItem itemLabel="1950" itemValue="1950"/>
								<f:selectItem itemLabel="1949" itemValue="1949"/>
								<f:selectItem itemLabel="1948" itemValue="1948"/>
								<f:selectItem itemLabel="1947" itemValue="1947"/>
								<f:selectItem itemLabel="1946" itemValue="1946"/>
								<f:selectItem itemLabel="1945" itemValue="1945"/>
								<f:selectItem itemLabel="1944" itemValue="1944"/>
								<f:selectItem itemLabel="1943" itemValue="1943"/>
								<f:selectItem itemLabel="1942" itemValue="1942"/>
								<f:selectItem itemLabel="1941" itemValue="1941"/>
								<f:selectItem itemLabel="1940" itemValue="1940"/>
								<f:selectItem itemLabel="1939" itemValue="1939"/>
								<f:selectItem itemLabel="1938" itemValue="1938"/>
								<f:selectItem itemLabel="1937" itemValue="1937"/>
								<f:selectItem itemLabel="1936" itemValue="1936"/>
								<f:selectItem itemLabel="1935" itemValue="1935"/>
								<f:selectItem itemLabel="1934" itemValue="1934"/>
								<f:selectItem itemLabel="1933" itemValue="1933"/>
								<f:selectItem itemLabel="1932" itemValue="1932"/>
								<f:selectItem itemLabel="1931" itemValue="1931"/>
								<f:selectItem itemLabel="1930" itemValue="1930"/>
								<f:selectItem itemLabel="1929" itemValue="1929"/>
								<f:selectItem itemLabel="1928" itemValue="1928"/>
								<f:selectItem itemLabel="1927" itemValue="1927"/>
								<f:selectItem itemLabel="1926" itemValue="1926"/>
								<f:selectItem itemLabel="1925" itemValue="1925"/>
								<f:selectItem itemLabel="1924" itemValue="1924"/>
								<f:selectItem itemLabel="1923" itemValue="1923"/>
								<f:selectItem itemLabel="1922" itemValue="1922"/>
								<f:selectItem itemLabel="1921" itemValue="1921"/>
								<f:selectItem itemLabel="1920" itemValue="1920"/>
								<f:selectItem itemLabel="1919" itemValue="1919"/>
								<f:selectItem itemLabel="1918" itemValue="1918"/>
								<f:selectItem itemLabel="1917" itemValue="1917"/>
								<f:selectItem itemLabel="1916" itemValue="1916"/>
								<f:selectItem itemLabel="1915" itemValue="1915"/>
								<f:selectItem itemLabel="1914" itemValue="1914"/>
								<f:selectItem itemLabel="1913" itemValue="1913"/>
								<f:selectItem itemLabel="1912" itemValue="1912"/>
								<f:selectItem itemLabel="1911" itemValue="1911"/>
								<f:selectItem itemLabel="1910" itemValue="1910"/>
								<f:selectItem itemLabel="1909" itemValue="1909"/>
								<f:selectItem itemLabel="1908" itemValue="1908"/>
								<f:selectItem itemLabel="1907" itemValue="1907"/>
								<f:selectItem itemLabel="1906" itemValue="1906"/>
								<f:selectItem itemLabel="1905" itemValue="1905"/>
								<f:selectItem itemLabel="1904" itemValue="1904"/>
								<f:selectItem itemLabel="1903" itemValue="1903"/>
								<f:selectItem itemLabel="1902" itemValue="1902"/>
								<f:selectItem itemLabel="1901" itemValue="1901"/>
								<f:selectItem itemLabel="1900" itemValue="1900"/>
							</p:selectOneMenu>
							
						</p:panelGrid>
							<br/><br/>
						<p:commandButton id="atualizar" value="ATUALIZAR" oncomplete="PF('popupconfirmacaratualizacao').show()" update=":form:dialog2"/>
						<p:commandButton value="CANCELAR" onclick="PF('popup').hide()"/>
				</p:dialog>
				
				<p:dialog id="dialog2" widgetVar="popupconfirmacaratualizacao" header="Salvar">
					<p:outputLabel value="DESEJA SALVAR AS ALTERAÇÕES EM #{PesquisaMB.movie.nome}" /><br/>
					<p:commandButton id="confirmaatualizacao" value="SIM" actionListener="#{PesquisaMB.editaPesquisa}" update="form:table" oncomplete="PF('popupconfirmacaratualizacao').hide();PF('popup').hide();"  style="margin-top: 20px;"/>
					<p:commandButton value="NÃO" onclick="PF('popupconfirmacaratualizacao').hide()"/>
				</p:dialog>
				
				<p:dialog id="dialog3" widgetVar="popupconfirmacarexclusao" header="Excluir">
					<p:outputLabel value="DESEJA EXCLUIR #{PesquisaMB.nome} ?" /><br/> 
					<p:commandButton id="confirmaexclusao" value="SIM" actionListener="#{PesquisaMB.remove(PesquisaMB.movie)}" oncomplete="PF('popupconfirmacarexclusao').hide();"  style="margin-top: 20px;" update="table"/>
					<p:commandButton value="NÃO" onclick="PF('popupconfirmacarexclusao').hide()"/>
				</p:dialog>
				
				<p:commandButton style="font-size:10px;font-style: italic;margin-top:10px" value="VOLTAR" action="#{MenuMB.voltar}" icon="ui-icon-arrowthick-1-w"/>
		</p:panel>
	</h:form>
	</center>
</h:body>
</html>